function rest=EsqintBMsq(pathnum)

intBMsq=zeros(100,1);
time=linspace(0,1,100)';
time2=linspace(0,1,10000);
for pn=1:pathnum
    disp(pn);
    getpath=ouprocess(0,0,0,1,10000);
    %getpath=exp(time2);
    BMsq=getpath.^2;
    for jj=1:100
        intBMsq(jj)=intBMsq(jj)+midptrule(BMsq(1:(jj-1)*101+1),1/9999)^2;
    end
end

rest=intBMsq/pathnum;
hold on
plot(time,5/8*time.^4)
%plot(time,1/4*(exp(2*time)-1).^2)
plot(time,rest,'r-')


